package donjuan;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
class Confirm extends JDialog implements ActionListener
{
	private String data[][]=new String[1][3];
	JButton a,b,c;
	selfPanel pan;
	Confirm()
	{
		setData();
		init();
		setVisible(true);
		setTitle("登陆选项");
		setBounds(750,400,300,100);
	}
	void init()
	{
		a=new JButton("登陆");//输入密码，查找已经存在的表
		b=new JButton("注册");//注册新表
		c=new JButton("自动登陆");//直接进入查找页面
		pan=new selfPanel();
		pan.setVisible(true);

		pan.add(a);pan.add(b);pan.add(c);
		a.addActionListener(this);
		b.addActionListener(this);
		c.addActionListener(this);
		a.setBorder(BorderFactory.createRaisedBevelBorder());
	    a.setFont(new Font("华文新魏",1,15));
	    b.setBorder(BorderFactory.createRaisedBevelBorder());
	    b.setFont(new Font("华文新魏",1,15));
	    c.setBorder(BorderFactory.createRaisedBevelBorder());
	    c.setFont(new Font("华文新魏",1,15));
		add(pan);
	}
	private void setData()
	{
		data[0][0]="root";
		data[0][1]="114514";
		data[0][2]="test2";
	}
	public void actionPerformed(ActionEvent e) {
		if(e.getSource()==a)
		{
			 Window_main.mode = 1;
		     Message.judgement = Boolean.valueOf(true);
		     Window_main.jump();
		     Message.show.setVisible(true);
		     dispose();
		   }
		else if(e.getSource()==b)
		{
			  Window_main.mode = 4;
		      Message.judgement = Boolean.valueOf(false);
		      Window_main.jump();
		      Message.show.setVisible(true);
		      dispose();
		}
		else if(e.getSource()==c)
		{
			AutoRegister pass=new AutoRegister();
		    dispose();
		}
	}
	private class selfPanel extends JPanel{
	    @Override
	    protected void paintComponent(Graphics g) {
	        super.paintComponent(g);
	        ImageIcon bg=new ImageIcon("src/confirmbackground.jpg");
	        bg.paintIcon(this, g, 0, 0);
	    }
	}
}
